package com.tbit.uqbike.webmanager.dao.capital;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tbit.config.datasource.DataSource;
import com.tbit.uqbike.object.pojo.RefundLog;
import com.tbit.uqbike.object.pojo.RefundOrder;
import com.tbit.uqbike.object.pojo.RideUserRefund;
import com.tbit.uqbike.object.pojo.dto.RefundLogDTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Author:BUGTian
 * @DATE: 2022/11/16
 */
@DS(DataSource.CAPITAL)
public interface RefundLogDao extends BaseMapper<RefundLog> {
    /**
     * 分页查询退款详情
     *
     * @param refundLogDTO
     * @return
     */
    List<RefundLog> queryList(RefundLogDTO refundLogDTO);

    /**
     * 查询退款汇总
     *
     * @param refundLogDTO
     * @return
     */
    @MapKey("changeType")
    Map<Integer, RefundLog> sumRefundLog(RefundLogDTO refundLogDTO);

    /**
     * 查询运营营收的退款汇总
     *
     * @return
     */
    @MapKey("changeType")
    Map<Integer, RefundLog> sumOpRefundLog(Integer brandId, String accountIds, Date startTime, Date endTime);

    /**
     * 查询运营营收的退款详情
     *
     * @return
     */
    List<RefundLog> getOpRefundList(String accountIds, Date startTime, Date endTime, Integer brandId);

    /**
     * 骑行订单退款表记录分布
     *
     * @param downloadDTO 。
     * @return 。
     */
    int orderRefundDistributionCount(String accountIds, Date startTime, Date endTime, Integer brandId);

    /**
     * @param accountIds
     * @param startTime
     * @param endTime
     * @param brandId
     * @return
     */
    List<RideUserRefund> selectOrderRefundDistribution(String accountIds, Date startTime, Date endTime, Integer brandId);

    /**
     * 添加
     * @param entities
     */
    void insertBatch(@Param("entities") List<RefundLog> entities);

    int deleteByBusinessNos(@Param("businessNos") List<String> businessNos);
}
